package com.leve.admin.common;

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class DateUtils {


    public static Date startDate(int star) {
        Date date = new Date();
        Calendar c1 = new GregorianCalendar();
        c1.setTime(date);
        c1.add(Calendar.DAY_OF_MONTH, -star);
        c1.set(Calendar.HOUR_OF_DAY, 0);
        c1.set(Calendar.MINUTE, 0);
        c1.set(Calendar.SECOND, 0);
        return c1.getTime();
    }

    public static Date endDate(int end) {
        Date date = new Date();
        Calendar c2 = new GregorianCalendar();
        c2.setTime(date);
        c2.add(Calendar.DAY_OF_MONTH, -end);
        c2.set(Calendar.HOUR_OF_DAY, 23);
        c2.set(Calendar.MINUTE, 59);
        c2.set(Calendar.SECOND, 59);
        return c2.getTime();
    }
}
